<?php
class FP_Dao_Permission extends Doctrine_Record
{

    public function setTableDefinition()
    {
        $this->setTableName('fp_permission');
        $this->option('charset', 'utf8');
        $this->option('collate', 'utf8_unicode_ci');
        $this->option('type', 'MyISAM');
        $this->hasColumn('permission_id', 'integer', 4, array('type' => 'integer' ,'length' => 4, 'unsigned' => 1, 'primary' => true, 'autoincrement' => true ));
        $this->hasColumn('name', 'string', 255, array('type' => 'string' ,'length' => 255, 'notnull' => true ));
        $this->hasColumn('type', 'string', 255, array('type' => 'string' ,'length' => 255, 'notnull' => true ));
        $this->hasColumn('resource', 'string', 255, array('type' => 'string' ,'length' => 255, 'notnull' => true ));
        $this->hasColumn('privilege', 'string', 255, array('type' => 'string' ,'length' => 255, 'notnull' => true ));

    }

    public function setUp()
    {
        $this->hasMany('FP_Dao_User as Users', array('refClass' => 'FP_Dao_UserPermission', 'local' => 'permission_id', 'foreign' => 'user_id'));
        $this->hasMany('FP_Dao_Role as Roles', array('refClass' => 'FP_Dao_RolePermission', 'local' => 'permission_id', 'foreign' => 'role_id'));
    }


}

 ?>